<?php
final class SendMail {
	public function send_mail($to_mail,$subject,$content)
	{
		include "class.phpmailer.php"; 
		include "class.smtp.php"; 
		$mail = new PHPMailer();
		$mail->IsSMTP(); // set mailer to use SMTP
		$mail->Host = "smtp.gmail.com"; // specify main and backup server
		$mail->Port = 465; // set the port to use
		$mail->SMTPAuth = true; // turn on SMTP authentication
		$mail->SMTPSecure = 'ssl';
		$mail->Username = "mail.namdaiphat@gmail.com"; // your SMTP username or your gmail username
		$mail->Password = "legendit"; // your SMTP password or your gmail password
		$from = "mail.namdaiphat@gmail.com"; // Reply to this email
		$to= $to_mail; // Recipients email ID
		$name="Nam Dai Phat Company"; // Recipient's name
		$mail->From = $from;
		$mail->FromName = "Admin Nam Dai Phat"; // Name to indicate where the email came from when the recepient received
		$mail->AddAddress($to,$name);
		$mail->AddReplyTo($from,"Admin Nam Dai Phat");
		$mail->WordWrap = 50; // set word wrap
		$mail->IsHTML(true); // send as HTML
		$mail->Subject = $subject;
		$mail->Body = $content; //HTML Body
		$mail->AltBody = "Mail này được gửi từ Admin Nam Đại Phát"; //Text Body
		//$mail->SMTPDebug = 2;
		if(!$mail->Send())
		{
			return 0;
		}
		else
		{
			return 1;
		}
		
			  		
	}
}
?>